/**
 * 
 */
package com.lyjilu.model.dao.impl;

import java.util.List;

import org.springframework.orm.jpa.support.JpaDaoSupport;

/**
 * @author Administrator
 *
 */
public class BaseDao extends JpaDaoSupport{

	public void save(Object obj){
		this.getJpaTemplate().persist(obj);
	}
	public void update(Object obj){
		this.getJpaTemplate().merge(obj);
	}
	public void delete(Object obj){
		this.getJpaTemplate().remove(obj);
	}
	@SuppressWarnings("unchecked")
	public Object findsingle(String queryStr){
		List<Object> list = this.getJpaTemplate().find(queryStr);
		return (list != null && list.size() > 0)?list.get(0):null;
	}
	@SuppressWarnings("unchecked")
	public Object findsingle(String queryStr,Object... values ){
		List<Object> list = this.getJpaTemplate().find(queryStr,values);
		return (list != null && list.size() > 0)?list.get(0):null;
	}
}
